#ifndef _WEBSERVER_H
#define _WEBSERVER_H

#include <Socket.h>
#include <Acceptor.h>
#include <Connection.h>
#include <Log.h>
#include <map>

class EventLoop;
class Channel;
class WebServer
{
private:
    EventLoop *_loop;
    Acceptor *_acceptor;
    std::map<int, Connection*> _map;
    Log* log;
    
    void handleConnection(Socket*);

    void deleteConnection(Socket*);

    // void handleReadEvent(int sockFd);

public:
    explicit WebServer(uint16_t port, bool openLog = true, int logLevel = 1, int logSize = 0);
    ~WebServer();

    void start();
};
#endif  // _WEBSERVER_H